﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Student
    {
        public int ID { get; set; }
        public string name { get; set; }
        public char sex { get; set; }
        public int age
        {
            get { return age; }
            set
            {
                if (value < 0 || value > 128)
                {

                    age = 0;
                }
                else {
                    age = value;
                }
                
            }
        }
        public string work { get; set; }
        public Student(int ID, string name, char sex, int age, string work) {
            this.ID = ID;
            this.name = name;
            this.sex = sex;
            this.age = age;
            this.work = work;
        }
        public void print() {
            Console.WriteLine($"学号{ID}姓名{name}性别{sex}年龄{age}职业{work}");
        }
    }
}
